﻿using DevExpress.XtraEditors;
using ImageTaskModule;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CustomModule
{
    public partial class FormEngineer : DevExpress.XtraEditors.XtraForm
    {
        public FormEngineer()
        {
            InitializeComponent();
        }

        private void simpleButton工具设定_Click(object sender, EventArgs e)
        {
            FormFirstTimeToolSetting form = new FormFirstTimeToolSetting();
            form.TopLevel = false;
            form.Size = this.Size;
            this.Controls.Add(form);
            form.Show();
            form.BringToFront();
            
        }

        private void simpleButton相机标定_Click(object sender, EventArgs e)
        {
            Form form = ImageCalibActionModule.CalibActionMagager.OpenActionModuleForm();
            form.TopLevel = false;
            form.Size = this.Size;
            this.Controls.Add(form);
            form.Show();
            form.BringToFront();
        }

        private void simpleButton胶路设定_Click(object sender, EventArgs e)
        {
            double dZoffSet = TableModule.TableManager.tableRunner.GetPosition("产品离皮带高度").dZPos;
            ImageCalibModule.ImageCalibManager.ImageCalibHandeye.SetZOffSet(dZoffSet);
            Form form = GluePathModule.GluePathManager.ShowManagerForm();
            form.TopLevel = false;
            form.Size = this.Size;
            this.Controls.Add(form);
            form.Show();
            form.BringToFront();
        }

        private void simpleButton产品图像设定_Click(object sender, EventArgs e)
        {
            
            FormImageTaskItem formImageTaskItem = new FormImageTaskItem(ImageTaskManager.ImageTask("ProductDetect"));
            formImageTaskItem.TopLevel = false;
            formImageTaskItem.Size = this.Size;
            this.Controls.Add(formImageTaskItem);
            formImageTaskItem.Show();
            formImageTaskItem.BringToFront();
           
        }

        private void FormEngineer_FormClosing(object sender, FormClosingEventArgs e)
        {
            foreach (Control control in Controls)
            {
                Form form = control as Form;
                if (form != null)
                {
                    form.Close();
                }
            }
        }
    }
}